setContentCaptureSession
open fun setContentCaptureSession(@NonNull v: View, @Nullable contentCaptureSession: ContentCaptureSessionCompat)(source)
Sets the (optional) ContentCaptureSession associated with this view.
This method should be called when you need to associate a ContentCaptureContext to the content capture events associated with this view or its view hierarchy (if it's a ViewGroup).
For example, if your activity is associated with a web domain, first you would need to set the context for the main DOM:
ContentCaptureSession mainSession = rootView.getContentCaptureSession();
mainSession.setContentCaptureContext(ContentCaptureContext.forLocusId(Uri.parse(myUrl));
Content copied to clipboard
Then if the page had an IFRAME
, you would create a new session for it:
ContentCaptureSession iframeSession = mainSession.createContentCaptureSession(
ContentCaptureContext.forLocusId(Uri.parse(iframeUrl)));
iframeView.setContentCaptureSession(iframeSession);
Content copied to clipboard
- SDK 29 and above, this method matches platform behavior.
- SDK 28 and below, this method does nothing.
Parameters
v
The View against which to invoke the method.
contentCaptureSession
a session created by createContentCaptureSession.